<!doctype html>
<html lang="{{ app()->getLocale() }}">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <!-- CSRF Token -->
        <meta name="csrf-token" content="{{ csrf_token() }}">

        <title>@yield('title')</title>

        <!-- Styles -->
        <link  rel="stylesheet" href="{{ asset('css/app.css') }}">
        <link  rel="stylesheet" href="{{ asset('css/layout/layout.css') }}">
        <link  rel="stylesheet" href="{{ asset('css/layout/list.css') }}">
        <link  rel="stylesheet" href="{{ asset('css/layout/create.css') }}">
        @yield('css')
    </head>
    <body>
        <nav class="nav-top">
            <div class="container-fluid">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                        <span class="sr-only">Toggle navigation</span>
                        <i class="fa fa-caret-down fa-lg" aria-hidden="true"></i>
                    </button>

                    <a class="navbar-brand" href="#">yuejian</a>
                </div>

                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav navbar-right">
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">管理员 <i class="fa fa-caret-down" aria-hidden="true"></i></a>
                            <ul class="dropdown-menu">
                                <li>
                                    <a id="logout" href="#">
                                        <form action="{{ route('logout') }}" method="POST">
                                            {{ csrf_field() }}
                                            {{ method_field('DELETE') }}
                                            <button class="btn btn-block btn-primary" type="submit" name="button">退出</button>
                                        </form>
                                    </a>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
        </nav>

        <div class="row">
            <div class="col-md-2">
                <section>
                    <ul id="accordion" class="accordion">
                        <li>
                            <div class="link"><i class="fa fa-user-circle" aria-hidden="true"></i>用户管理<i class="fa fa-chevron-down"></i></div>
                            <ul class="submenu">
                                <li>
                                    <a href="{{ route('userList') }}">
                                        <span>用户列表</span>
                                        <span><i class="fa fa-angle-right" aria-hidden="true"></i></span>
                                    </a>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <div class="link"><i class="fa fa-bullhorn" aria-hidden="true"></i>活动管理<i class="fa fa-chevron-down"></i></div>
                            <ul class="submenu">
                                <li>
                                    <a href="{{ route('activity.index') }}">
                                        <span>活动列表</span>
                                        <span><i class="fa fa-angle-right" aria-hidden="true"></i></span>
                                    </a>
                                </li>
                                <li>
                                    <a href="{{ route('activityOrder.index')}}">
                                        <span>活动订单</span>
                                        <span><i class="fa fa-angle-right" aria-hidden="true"></i></span>
                                    </a>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <div class="link"><i class="fa fa-gitlab" aria-hidden="true"></i>俱乐部管理<i class="fa fa-chevron-down"></i></div>
                            <ul class="submenu">
                                <li>
                                    <a href="{{ route('clubLeader.index') }}">
                                        <span>管理员列表</span>
                                        <span><i class="fa fa-angle-right" aria-hidden="true"></i></span>
                                    </a>
                                </li>
                                <li>
                                    <a href="{{ route('club.index') }}">
                                        <span>俱乐部列表</span>
                                        <span><i class="fa fa-angle-right" aria-hidden="true"></i></span>
                                    </a>
                                </li>
                                <li>
                                    <a href="{{ route('cvideo.index') }}">
                                        <span>俱乐部视频</span>
                                        <span><i class="fa fa-angle-right" aria-hidden="true"></i></span>
                                    </a>
                                </li>
                                <li>
                                    <a href="{{ route('clesson.index') }}">
                                        <span>俱乐部课程</span>
                                        <span><i class="fa fa-angle-right" aria-hidden="true"></i></span>
                                    </a>
                                </li>
                                <li>
                                    <a href="{{ route('ccoach.index') }}">
                                        <span>俱乐部教练</span>
                                        <span><i class="fa fa-angle-right" aria-hidden="true"></i></span>
                                    </a>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <div class="link"><i class="fa fa-user" aria-hidden="true"></i>大师管理<i class="fa fa-chevron-down"></i></div>
                            <ul class="submenu">
                                <li>
                                    <a href="{{ route('master.index' )}}">
                                        <span>大师列表</span>
                                        <span><i class="fa fa-angle-right" aria-hidden="true"></i></span>
                                    </a>
                                </li>
                                <li>
                                    <a href="{{ route('mvideo.index') }}">
                                        <span>大师视频</span>
                                        <span><i class="fa fa-angle-right" aria-hidden="true"></i></span>
                                    </a>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <div class="link"><i class="fa fa-question-circle-o" aria-hidden="true"></i>大师问答管理<i class="fa fa-chevron-down"></i></div>
                            <ul class="submenu">
                                <li>
                                    <a href="{{ route('questions.index') }}">
                                        <span>大师提问列表</span>
                                        <span><i class="fa fa-angle-right" aria-hidden="true"></i></span>
                                    </a>
                                </li>
                                <li>
                                    <a href="{{ route('answers.index') }}">
                                        <span>大师回答列表</span>
                                        <span><i class="fa fa-angle-right" aria-hidden="true"></i></span>
                                    </a>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <div class="link"><i class="fa fa-graduation-cap" aria-hidden="true"></i>培训管理<i class="fa fa-chevron-down"></i></div>
                            <ul class="submenu">
                                <li>
                                    <a href="{{route('train.index')}}">
                                        <span>培训列表</span>
                                        <span><i class="fa fa-angle-right" aria-hidden="true"></i></span>
                                    </a>
                                </li>
                                <li>
                                    <a href="{{route('trainOrder.index')}}">
                                        <span>培训订单</span>
                                        <span><i class="fa fa-angle-right" aria-hidden="true"></i></span>
                                    </a>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <div class="link"><i class="fa fa-trophy" aria-hidden="true"></i>比赛管理<i class="fa fa-chevron-down"></i></div>
                            <ul class="submenu">
                                <li>
                                    <a href="{{route('match.index')}}">
                                        <span>比赛列表</span>
                                        <span><i class="fa fa-angle-right" aria-hidden="true"></i></span>
                                    </a>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <div class="link"><i class="fa fa-send" aria-hidden="true"></i>晒图管理<i class="fa fa-chevron-down"></i></div>
                            <ul class="submenu">
                                <li>
                                    <a href="{{route('sunPicture.index')}}">
                                        <span>晒图列表</span>
                                        <span><i class="fa fa-angle-right" aria-hidden="true"></i></span>
                                    </a>
                                </li>
                                <li>
                                    <a href="{{route('postComments.index')}}">
                                        <span>评论列表</span>
                                        <span><i class="fa fa-angle-right" aria-hidden="true"></i></span>
                                    </a>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </section>
            </div>
            <div class="col-md-8">
                @include('shared._message')
                @yield('content')
            </div>
        </div>

        <footer class="footer">
            <span>Copyright © 2017 By yuejian11</span>
        </footer>

        <script src="/js/app.js"></script>
        <script src="/js/jquery.toaster.js"></script>
        <script>
            $(document).ready(function () {
                //及时隐藏消息提示
                $('p.alert').not('.alert-important').delay(2000).fadeOut(350);

                var Accordion = function(el, multiple) {
                    this.el = el || {};
                    this.multiple = multiple || false;

                    var links = this.el.find('.link');
                    links.on('click', {el: this.el, multiple: this.multiple}, this.dropdown)
                }

                Accordion.prototype.dropdown = function(e) {
                    var $el = e.data.el;
                        $this = $(this),
                        $next = $this.next();

                    $next.slideToggle();
                    $this.parent().toggleClass('open');

                    if (!e.data.multiple) {
                        $el.find('.submenu').not($next).slideUp().parent().removeClass('open');
                    };
                }

                var accordion = new Accordion($('#accordion'), false);
            
                // update avatar
                var fileInput=document.querySelector('input[type=file]'),
                previewImg=document.querySelector('img[title=preview-img]');
                fileInput.addEventListener('change',function(){
                    var file=this.files[0];
                    var reader=new FileReader();
                    reader.addEventListener("load",function(){
                    previewImg.src=reader.result;
                    previewImg.style.width=100+'px';
                    previewImg.style.height=100+'px';
                    },false);
                    reader.readAsDataURL(file);
                },false);

            });
        </script>
        @yield('js')
    </body>
</html>
